#!/usr/bin/env bash
if [[ $# -ne 1 ]]
then
    echo "Incorect number of parameter should be 1"
    exit 1
fi

if [ ! -f $HOME/.local/bin/folder-table.sh ]
then
    echo "Table wit folder name was not found"
    exit 1
fi

source folder-table.sh

if [ -z ${dir_table["$1"]} ] 
then
    echo Unknown key $1 in dir folder
    exit 1
fi

target_dir=${dir_table["$1"]}
echo "Actual folder : $target_dir"
if [ ! -d $target_dir ]
then
    echo $target_dir not found
    exit 1
fi
cd ${dir_table["$1"]}
pwd
